package com.katsu.myapplib.util;

import android.content.Context;
import android.util.Xml;
import android.view.LayoutInflater;
import android.view.View;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;

public class UtilAssetsXmlParser {
    private UtilAssetsXmlParser() {}

    public static View getView(Context context, String filePaht) {

        return LayoutInflater.from(context).inflate(getXmlPullParser(context, filePaht), null);

    }

    public static XmlPullParser getXmlPullParser(Context context, String filePaht) {

        XmlPullParser xmlPullParser = null;

        try {

            xmlPullParser = Xml.newPullParser();

            xmlPullParser.setInput(context.getAssets().open(filePaht), "UTF-8");

        } catch (IOException e) {

            e.printStackTrace();

        }catch (XmlPullParserException e) {

            e.printStackTrace();

        }

        return xmlPullParser;

    }
}
